package com.smartmedical.system.api.factory;

import com.smartmedical.common.core.domain.HealthR;
import com.smartmedical.common.core.domain.R;
import com.smartmedical.system.api.RemotePatientUserService;
import com.smartmedical.system.api.domain.PatientUsers;
import com.smartmedical.system.api.model.PatientUserJwt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemotePatientUserFallbackFactory implements FallbackFactory<RemotePatientUserService>
{
    private static final Logger log = LoggerFactory.getLogger(RemotePatientUserFallbackFactory.class);

    @Override
    public RemotePatientUserService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());

        return new RemotePatientUserService()
        {

            @Override
            public R<PatientUserJwt> getDoctorInfo(String email) {
                return R.fail("邮箱不存在");
            }


        };
    }
}
